{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 当你打印一个数组，NumPy以类似嵌套列表的形式显示它，但是呈以下布局： \n",
    "\n",
    "#### 最后的轴从左到右打印 \n",
    "#### 次后的轴从顶向下打印 \n",
    "##### 剩下的轴从顶向下打印，每个切片通过一个空行与下一个隔开 "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "一维数组被打印成行，二维数组成矩阵，三维数组成矩阵列表。 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from numpy import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0, 1, 2, 3, 4, 5])"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = arange(6)\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "b = arange(12).reshape(4,3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[ 0  1  2]\n",
      " [ 3  4  5]\n",
      " [ 6  7  8]\n",
      " [ 9 10 11]]\n"
     ]
    }
   ],
   "source": [
    "print(b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[[ 0  1  2  3]\n",
      "  [ 4  5  6  7]\n",
      "  [ 8  9 10 11]]\n",
      "\n",
      " [[12 13 14 15]\n",
      "  [16 17 18 19]\n",
      "  [20 21 22 23]]]\n"
     ]
    }
   ],
   "source": [
    "c = arange(24).reshape(2,3,4)\n",
    "print(c)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "查看形状操作一节获得有关reshape的更多细节 \n",
    "如果一个数组用来打印太大了，NumPy自动省略中间部分而只打印角落 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[     0      1      2 ..., 999997 999998 999999]\n"
     ]
    }
   ],
   "source": [
    "print(arange(1000000))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[   0    1    2 ...,   97   98   99]\n",
      " [ 100  101  102 ...,  197  198  199]\n",
      " [ 200  201  202 ...,  297  298  299]\n",
      " ..., \n",
      " [9700 9701 9702 ..., 9797 9798 9799]\n",
      " [9800 9801 9802 ..., 9897 9898 9899]\n",
      " [9900 9901 9902 ..., 9997 9998 9999]]\n"
     ]
    }
   ],
   "source": [
    "print(arange(10000).reshape(100,100))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "禁用NumPy的这种行为并强制打印整个数组，你可以设置printoptions参数来更改打印选项。 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    " set_printoptions(threshold='nan') "
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
